$(function(){
	$("#btnLogin").on('click',function(obj){
		gotoLogin();
	});
	$("#memberPassword").bind("keydown", function (e) {
		var key = e.which;
		if (key == 13){
			gotoLogin();
		}
	});
});
/*管理员登录代码*/
function gotoLogin(){
	var memberMobile=$("#memberMobile").val().trim();
	var memberPassword=$("#memberPassword").val().trim();
	if(memberMobile==null || memberMobile==""){
		consoleMes($("#webContent"),2000,"warning","请输入手机！");
		return;
	}
	/*if(!ischeckmobile(memberMobile)){
		consoleMes($("#webContent"),2000,"warning","手机格式不正确！");
		return;
	}*/
	if(memberPassword==null || memberPassword==""){
		consoleMes($("#webContent"),2000,"warning","请输入密码！");
		return;
	}
	memberPassword=$.md5(memberPassword);
	loginForm(memberMobile,memberPassword);
}
function loginForm(memberMobile,memberPassword){
	/*consoleMes($("#webContent"),2000,"success","系统正在登录中！");//success、info、warning、danger
	setTimeout(function () {
    	window.location.href=gobalWeb+"index.html";
    }, 2500);*/
   var account = {
        "loginName": memberMobile,
        "password": memberPassword
    };
   $.post(
       gobalServer+"user/login",
       account,
       function(backData) {
           if (backData.statusCode == 200) {
               consoleMes($("#webContent"), 2000, "success", backData.msg);//success、info、warning、danger
               setTimeout(function () {
                   window.location.href = gobalWeb + "index.html";
               }, 2500);
           } else {
               consoleMes($("#webContent"), 2000, "warning", backData.msg);//success、info、warning、danger

           }
       }
   );
};
